const CopyWebpackPlugin = require('copy-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

const webpack = require('webpack')
const config = require('./webpack.common')
const { merge } = require('webpack-merge')

module.exports = (env, argv) => {
    return merge(config, {
        mode: 'production',
        devtool: 'none',
        plugins: [
            new HtmlWebpackPlugin({
                title: 'producted by heaven',
                template: './public/index.html'
            }),
            new CleanWebpackPlugin(),
            new CopyWebpackPlugin({
                patterns: [
                    'public'
                ]
            }),
            new webpack.DefinePlugin({
                BASE_URL: '""'
            })
        ]
    })
}